{% extends 'IcsocUIBundle::page.html.twig' %}
{% from 'IcsocUIBundle:Macro:grid.html.twig' import gridWidth,gridNav,gridConfig,gridKeyword,sendKeyWord %}
{% block stylesheet %}
    {{ parent() }}
    {% stylesheets
    '@jqgird_css'
    '@gritter_css'
    filter='cssrewrite' filter='uglifycss'
    %}
    <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}
{% endblock %}

{% block content %}
    {{ gridKeyword('Group name'|trans) }}
    <table id="grid-table"></table>
    <div id="grid-pager"></div>
{% endblock %}
{% block footer %}
    {% javascripts
    '@jqgird_js'
    '@gritter_js'
    '@common_js'
    filter='uglifyjs'
    %}
    <script src="{{ asset_url }}"></script>
    {% endjavascripts %}
    <script type="text/javascript">
        jQuery(function($) {
            {{ gridWidth() }}
            jQuery(grid_selector).jqGrid({
                url: "{{ path('icsoc_group_list') }}",  //数据；
                colNames:['{{ 'actions'|trans }}','id', '{{ 'Group name'|trans }} ',''],  //列显示名称，是一个数组对象
                colModel:[
                    {name:'myac',index:'', width:80, fixed:true, sortable:false, resize:false,
                        formatter:'actions',
                        formatoptions:{
                            keys:true,
                            editbutton:true,
                            editformbutton: true,
                            delOptions:{recreateForm: true, beforeShowForm:beforeDeleteCallback, afterSubmit:afterDeleteCallback},
                            editOptions:{width: "0",height: "0", jqModal:false, beforeShowForm:beforeEditCallback }
                        }
                    },
                    {name:'group_id',index:'groupId', width:90, fixed:true,hidden:true, editable: true, sortable:false, key:true},
                    {name:'group_name',index:'groupName',width:390,fixed:true, editable:true, sortable:false},
                    {name:'id',index:'id', hidden:true,editable:true,formatter:function(cellvalue, options, rowObject){
                        return  rowObject.group_id;
                    }}
                ],
                {{ gridConfig() }}
                sortname: 'groupId',
                editurl: "{{ path('icsoc_group_del') }}",//nothing is saved 定义对form编辑时的url
                caption: "{{ 'Business group list'|trans }}"//表格名称
            });
            {{ gridNav(false,false,true,false,true,true,path('icsoc_group_add'),path('icsoc_group_edit')) }}
        });
        {{ sendKeyWord() }}
    </script>
{% endblock %}